package com.showcai.redis;

import com.showcai.log.LogFactory;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by baggio on 2017/4/19.
 */
/*public class InitialExecutionBean implements ApplicationListener<ContextRefreshedEvent>{

    @Autowired
    RedisCache redisCache;

    private Logger logger = LogFactory.getLogger(this.getClass());

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        System.out.println("..............................................");
        if(event.getApplicationContext().getParent() == null){
            try {
                redisCache.removeByKey(User.ONLINEKEY);
                redisCache.removeByKey(User.REGISTEREDKEY);
                logger.info("初始化删除在线人数和登录人数成功。。。。。");
            } catch (Exception e) {
                e.printStackTrace();
                logger.info("初始化删除在线人数和登录人数失败。。。。。");
            }
        }
    }
}*/

/**
 * 修改初始化方法
 */
public class InitialExecutionBean implements InitializingBean {

    @Autowired
    RedisCache redisCache;

    private Logger logger = LogFactory.getLogger(this.getClass());

    @Override
    public void afterPropertiesSet() throws Exception {

    }

}